/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package core.io;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 *
 * @author Dung Pham
 */
public class CodecFactory implements ProtocolCodecFactory {

    private final ProtocolEncoder encoder;
    private final ProtocolDecoder decoder;
    
    public CodecFactory() {
        this.encoder = new MessageResponseEncoder();
        this.decoder = new MessageRequestDecoder();
    }

    @Override
    public ProtocolEncoder getEncoder(IoSession is) throws Exception {
        return this.encoder;      
    }

    @Override
    public ProtocolDecoder getDecoder(IoSession is) throws Exception {
        return this.decoder;
    }
    
}
